import $ from '../common';
Page({
  data: {
    titleHeight: $.gData().titleHeight,
    statuHeight: $.gData().statuHeight,
    info:[],
    page:1,
    tip:'下来加载更多'
  },
  onReachBottom(){
    console.log('触底了！！！');
    this.getinfo()
  },
  getinfo(){
    const {page,group_uuid,info}=this.data
    $.get('/campus/group/lessons',{
      page,
      group_uuid,
      limit:20
    },res=>{
      if(res.lessons.length==20){
        this.data.tip='下拉加载更多'
      }else{
        this.data.tip='已经到底了'
      }
      this.data.page++
      this.setData({
        info:[...info,...res.lessons],
        tip:this.data.tip
      })
    })
  },
  onLoad(e) {
    const {group_uuid}=e
    this.setData({
      group_uuid
    })
    this.getinfo()
  },
  onShow() {}
})